<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui">
<h:body>

	<p:fieldset legend="Dados do Cliente">
		<h:panelGrid columns="1">
		
			<h:selectOneRadio id="selecionaFisicaJuridica"
				value="#{solicitaColetaAction.form}"
				valueChangeListener="#{solicitaColetaAction.modoSeleciona}"
				onchange="submit()" immediate="true">
				<f:selectItem itemLabel="Pessoa Fisica" itemValue="PessoaFisica" />
				<f:selectItem itemLabel="Pessoa Juridica" itemValue="PessoaJuridica" />
			</h:selectOneRadio>
		</h:panelGrid>
		<h:panelGrid columns="3">			
			<h:outputLabel value="Digite Cpf:" rendered="#{solicitaColetaAction.campoFisica}" />
			<p:inputMask id="cpf" mask="999.999.999-99" rendered="#{solicitaColetaAction.campoFisica}"
				value="#{solicitaColetaAction.cpf}" size="11">

			</p:inputMask>
			<h:outputLabel value="Digite CNPJ:" rendered="#{solicitaColetaAction.campoJuridica}" />
			<p:inputMask id="cnpj" mask="99.999.999/9999-99" rendered="#{solicitaColetaAction.campoJuridica}"
				value="#{solicitaColetaAction.cpf}" size="11">

			</p:inputMask>
			<p:commandButton value="procurar" rendered="#{solicitaColetaAction.botaoProcurar}"
				actionListener="#{solicitaColetaAction.procurar}" update="mensagemConfirmacao"
				onclick="telaCadas.show()"/>
		
		</h:panelGrid>

		<h:panelGrid columns="2">
			<h:outputLabel value="Peso:" />

			<p:inputText id="inserirPeso"
				value="#{solicitaColetaAction.coleta.peso}">
				<f:convertNumber maxFractionDigits="2" />
			</p:inputText>
			<h:outputLabel value="Status" />

			<p:selectOneMenu value="#{solicitaColetaAction.coleta.status}"
				effect="drop">
				<f:selectItem itemLabel="Selecione Um" itemValue="" />
				<f:selectItem itemLabel="Solicitar" itemValue="Solicitação" />
				
			</p:selectOneMenu>

		</h:panelGrid>
	</p:fieldset>
<br/>
	
<p:dialog id="telaConfirmacaoCadastro" rendered="#{solicitaColetaAction.cadastrarCliente}" widgetVar="telaCadas" width="300" height="180"
			header="Cliente não Cadastrado" resizable="false">

<h:outputLabel value="Deseja Cadastra-lo?" style="color:blue;"/>
<h:panelGrid columns="2" cellpadding="15" cellspacing="3">
<p:commandButton value="Sim" actionListener="#{solicitaColetaAction.redirecionePaginaCadastro}" oncomplete="telaCadas.hide()"/>

<p:commandButton value="Não" onclick="telaCadas.hide()" type="button"/>
</h:panelGrid>


</p:dialog>


</h:body>

</html>